{% extends "basex.html" %}

{% block collaps %}
    <h1>About Decisions</h1>
    <br>
    <div class="help">
        When a lot of people generate a <b>decision</b>, there is no use of regular discussion.
        <br><br>The quality of the final decision depends on opinion independence.
        Now there are 3 moves to impact the final decision:
        <ul>
            <li>submit your answer</li>
            <li>submit a fact that may be important</li>
            <li>take part in solution creation via Solution Tree</li>
        </ul>
    </div>
{% endblock %}

{% block topbuttons %}
    <a href="/?rnd={{ rnd }}"
       data-icon="home"
       data-iconpos="notext">Home</a>
{% endblock %}

{% block content %}
    <br>
    <h2 style="margin-top: 0px;margin-bottom: 4px;">Question summary</h2>

    <div class="tip">Question text:</div>
    <div class="aquest" tabindex="0">
        <div class="hhide">&nbsp;
            {% if question.like %}Good <font color="#377de6">{{ question.like }}%</font>&nbsp;&nbsp;{% endif %}
            {% if question.bad %}Bad <font color="Red">{{ question.bad }}%</font>&nbsp;&nbsp;{% endif %}
            {% include "num" with n=question.imps word="rate" %}
        </div>
        {{ question.text|linebreaksbr }}
        <a href="/improve?id={{ question.key }}&rnd={{ rnd }}"
           class="hbutton"
           data-role="button"
           data-icon="star"
           data-inline="true"
           data-theme="e"
           data-rel="dialog">Improve</a>
    </div>

    <a data-role="button"
       data-icon="grid"
       data-inline="true"
       href='/tree?id={{ question.key }}&view=way&rnd={{ rnd }}'>Solution tree</a>
    <span class="tip"><b>{{ question.nodes }}</b> nodes total</span>
    {% if answers %}
        {% if question.solved %}
            <br><br><b>Right answer:</b>
        {% else %}
            <div class="subhead">Top answers:</div>
        {% endif %}
        <div class="indent">
            {% for answer in answers %}
                <div class="astate" style="margin-bottom: 12px;" tabindex="0">
                    <div class="hhide">&nbsp;
                        {% if answer.tlike %}Vote <font color="Green"><b>{{ answer.tlike }}%</b></font>&nbsp;
                            &nbsp;{% endif %}
                        {% if answer.like %}Check <font color="#377de6">{{ answer.like }}%</font>&nbsp;&nbsp;{% endif %}
                        {% if answer.bad %}Bad <font color="Red">{{ answer.bad }}%</font>&nbsp;&nbsp;{% endif %}
                        {% include "num" with n=answer.imps word="rate" %}

                    </div>
                    {% if answer.solved %}<font
                            size="2">{% endif %}{{ answer.text|linebreaksbr }}
                    <a href="/improve?id={{ answer.key }}&quest={{ question.key }}&rnd={{ rnd }}"
                       class="hbutton"
                       data-role="button"
                       data-icon="star"
                       data-inline="true"
                       data-theme="e"
                       data-rel="dialog">Improve</a>
                    {% if answer.solved %}</font>{% endif %}</div>
                {% if answer.solved %}<br><p>Top answers:</p>{% endif %}
            {% endfor %}
        </div>
    {% else %}
        <h1><font color="#CCCCCC">No good answers</font></h1>
    {% endif %}

    <a data-role="button"
       data-icon="plus"
       data-inline="true"
       href='/new?type=answer&id={{ question.key }}&rnd={{ rnd }}'>Add your answer</a>
    <span class="tip">{% if question.answers %}<b>{{ question.answers }}</b> answers total{% endif %}</span><br>


    {% if facts %}
        <div class="subhead">Important facts:</div>
        <div class="indent">
            {% for fact in facts %}
                <div class="astate" style="margin-bottom: 12px;" tabindex="0">
                    <div class="hhide">
                        {% if fact.like %}Important <font color="#377de6">{{ fact.like }}%</font>&nbsp;&nbsp;{% endif %}
                        {% if fact.bad %}Wrong <font color="Red">{{ fact.bad }}%</font>&nbsp;&nbsp;{% endif %}
                        {% include "num" with n=fact.imps word="rate" %}
                    </div>
                    {{ fact.text|linebreaksbr }}
                    <a href="/improve?id={{ fact.key }}&quest={{ question.key }}&rnd={{ rnd }}"
                       class="hbutton"
                       data-role="button"
                       data-icon="star"
                       data-inline="true"
                       data-theme="e"
                       data-rel="dialog">Improve</a>
                </div>
            {% endfor %}
        </div>
    {% endif %}

    <a data-role="button"
       data-icon="plus"
       data-inline="true"
       href='/new?type=fact&id={{ question.key }}&rnd={{ rnd }}'>Add fact</a>
    <span class="tip">{% if question.facts %}<b>{{ question.facts }}</b> facts total{% endif %}</span>

    <br><br>
    <div class="tip"><b>Tags:</b>
        {% for tag in question.tags %}
            <span class="tag">{{ tag }}</span>
        {% empty %}none
        {% endfor %}
        <br><br><input type="button" data-icon="plus"
                       data-inline="true" value="Add tags"
                       onclick="document.getElementById('addtag').style.visibility='visible';">
    </div>

    <div id="addtag" style="visibility:hidden">
        <form action="/add?type=tags&id={{ question.key }}&rnd={{ rnd }}" method="post">
            Add tag(s):
            <span class="tip">(single comma-separated words)</span><br><input name="text" cols="30"></input>
            <br><input type="submit" data-icon="check" data-theme="b"
                       data-inline="true" value="Submit">
        </form>
    </div>

{% endblock %}